<?php $suattr = $sf_user->getAttribute('suattr') ?>
<?php $myLib = new myLib(); ?>
<div style="float: right;padding: 10px;">
    <a href="<?php echo url_for('@homepage') ?>"><b>Volver a Opinics</b></a>
</div>
<div id="configuration_menu">
<ul>
    <li class="selected"><a href="<?php echo url_for('@dashboard') ?>">Configuraci&oacute;n</a></li>
    <?php if($sf_user->hasCredential('author')){ ?>
    <li><a href="<?php echo url_for('@articles_new') ?>">Escribir un artículo</a></li>
    <?php } ?>
    <li><a href="<?php echo url_for('@history') ?>">Historial</a></li>
</ul>
</div>
<div id="configuration_content">
  <div id="configuration_in">
    <table width="100%">
      <tr>
        <td width="250px" valign="top">
          <h1>CONFIGURACI&Oacute;N</h1>
            <div id="tipo_cuenta" style="width: 225px;height: 32px;border: 1px solid #cdd2d6;margin-top: 10px;">
                <div style="float: left;padding: 10px;background-color: #cdd2d6;">tipo</div>
                <div style="float: left;padding: 10px;font-weight: bold;width: 129px;">
                    <?php echo $suattr[8] ?>
                </div>
                <div style="float: left;padding: 7px;">
                    <?php if($suattr[1]=='1'){ ?>
                      <?php echo image_tag('escritor.png','size=16x16') ?>
                    <?php }elseif($suattr[1]=='2'){ ?>
                      <?php echo image_tag('lector.png','size=16x16') ?>
                    <?php } ?>
                </div>
            </div>
          <br /><br /><br /><br />
            <div style="padding: 10px;">
              <?php if($sf_user->hasCredential('author')){ ?>
              <div style="padding: 10px;padding-top: 0;">
                <div style="position: relative;left: -20px;top: 13px;"><?php echo image_tag('bullet1.png') ?></div>
                <a href="<?php echo url_for('@myArticles') ?>"><b>Mis articulos</b></a>
              </div>
              <div style="width: 60%;height: 1px;background-color: #cdd2d6;"></div>
              <?php } ?>
              <div style="padding: 10px;">
                <a href="<?php echo url_for('@myFavorites') ?>" style="font-weight: normal;">Mis favoritos</a>
              </div>
              <div style="width: 60%;height: 1px;background-color: #cdd2d6;"></div>
              <div style="padding: 10px;">
                <a href="<?php echo url_for('@myBalance') ?>" style="font-weight: normal;">Ingresos</a>
              </div>
            </div>
        </td>
        <td width="5px">
            <div style="width: 1px;height: 300px;background-color: #cdd2d6;"></div>
        </td>
        <td width="745px" valign="top">
            <div style="padding: 15px;">
                <div class="section">
                  <div class="title">
                      <div>MIS ART&Iacute;CULOS</div>
                  </div>
                  <div class="body">
                    <table border="1" cellpadding="15">
                      <?php if(count($articles)>0){ ?>
                      <tr class="table">
                        <td><b>fecha</b></td>
                        <td><b>titulo</b></td>
                        <td><b>acciones</b></td>
                      </tr>
                      <?php foreach($articles as $article){ ?>
                      <tr class="table2">
                        <td bgcolor="#cdd2d6"><?php echo $myLib->formattedDate3($article->getCreatedAt()) ?></td>
                        <td style="width: 510px;">
                            <a href="<?php echo url_for('@article?id='.$article->getId().'&slug='.$article->getSlug()) ?>">
                                <?php echo $article->getTitle() ?></a></td>
                        <td align="center">
                            <a href="<?php echo url_for('@article_edit?id='.$article->getId()) ?>" title="Edit this article">
                                <?php echo image_tag('editar.png','size=16x16') ?></a>
                            <a href="<?php echo url_for('@article_delete?id='.$article->getId()) ?>" onclick="return delete_confirm()" title="Delete this article">
                                <?php echo image_tag('eliminar.png','size=16x16') ?></a>
                        </td>
                      </tr>
                      <?php } ?>
                      <?php }else{ ?>
                      <tr class="table">
                        <td colspan="6">
                            Usted no ha escrito art&iacute;culos. <a href="<?php echo url_for('@articles_new') ?>" style="font-weight: bold;">Escribir uno</a>
                        </td>
                      </tr>
                      <?php } ?>
                    </table>
                  </div>
                </div>
                <br /><br /><br />
                <div class="section">
                  <div class="title">
                      <div>BORRADORES</div>
                  </div>
                  <div class="body">
                    <table border="1" cellpadding="15">
                      <?php if(count($draft_articles)>0){ ?>
                      <tr class="table">
                        <td><b>fecha</b></td>
                        <td><b>titulo</b></td>
                        <td><b>acciones</b></td>
                      </tr>
                      <?php foreach($draft_articles as $draft_article){ ?>
                      <tr class="table2">
                        <td bgcolor="#cdd2d6"><?php echo $myLib->formattedDate3($draft_article->getCreatedAt()) ?></td>
                        <td style="width: 510px;">
                            <a href="<?php echo url_for('@article_edit?id='.$draft_article->getId()) ?>">
                              <?php
                                if($draft_article->getTitle()!=''){
                                    echo $draft_article->getTitle();
                                }else{
                                    echo '(Sin titulo)';
                                }
                              ?>
                            </a>
                        </td>
                        <td align="center">
                            <a href="<?php echo url_for('@article_publish?id='.$draft_article->getId()) ?>" onclick="return delete_confirm()" title="Publish article">
                                <?php echo image_tag('publicar.png','size=16x16') ?></a>
                            <a href="<?php echo url_for('@article_discard?id='.$draft_article->getId()) ?>" onclick="return delete_confirm()" title="Delete draft">
                                <?php echo image_tag('eliminar.png','size=16x16') ?></a>
                        </td>
                      </tr>
                      <?php } ?>
                      <?php }else{ ?>
                      <tr class="table">
                        <td colspan="6">
                            Usted no tiene borradores.
                        </td>
                      </tr>
                      <?php } ?>
                    </table>
                  </div>
                </div>
            </div>
        </td>
      </tr>
    </table>
  </div>
</div>